﻿using System;
using System.Reflection;

namespace FluentResourceMapping.AutoMapping
{
    /// <summary>
    /// Implement this interface to control how the automapper behaves.
    /// </summary>
    public interface IAutomappingConfiguration
    {
        /// <summary>
        /// Determines whether a type should be auto-mapped.
        /// Override to restrict which types are mapped in your domain.
        /// </summary>
        /// <remarks>
        /// You normally want to override this method and restrict via something known, like
        /// Namespace.
        /// </remarks>
        /// <example>
        /// return type.Namespace.EndsWith("Domain");
        /// </example>
        /// <param name="type">Type to map</param>
        /// <returns>Should map type</returns>
        bool ShouldMap(Type type);

        /// <summary>
        /// Determines whether a member of a type should be auto-mapped.
        /// Override to restrict which members are considered in automapping.
        /// </summary>
        /// <param name="member">Member to map</param>
        /// <returns>Should map member</returns>
        bool ShouldMap(MemberInfo member);

        /// <summary>
        /// Determines whether a type should be auto-mapped to, i.e, the type is a desired resource class.
        /// Override to restrict which types can be used as resource.
        /// </summary>
        /// <remarks>
        /// You normally want to override this method and restrict via something known, like
        /// Namespace.
        /// </remarks>
        /// <example>
        /// return type.Namespace.EndsWith("Resources");
        /// </example>
        /// <param name="type">Type of the resource class</param>
        /// <returns>Is a resource class</returns>
        bool IsResource(Type type);
    }
}